package MsgPackage;

/**
 * @author Omri Barda		039725890 
 * @author Amit Joseph		034608547
 * @author Gilad Shpigel  	300162393
 * @author Elad Elbaz		040539959
 * @version June 2012
 */

import java.util.ArrayList;
import entities.Answer;
import entities.ComputerizedExam;
import entities.ExtractedExam;
import entities.QuestionPerExam;

public class GetExamsToApprovePack extends MessagePack {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ExtractedExam exrtExam;
	private ArrayList<ComputerizedExam> comExmsLst;
	private ArrayList<QuestionPerExam> qstnPerExmLst;

	/**
	 * constructor
	 * 
	 * @param exrtExam
	 */
	public GetExamsToApprovePack(ExtractedExam exrtExam) {
		setExrtExam(exrtExam);
		this.op = OpType.GetExamsToApprove;
	}

	/**
	 * 
	 * @param ExmsLst
	 *            exams to be added
	 */
	public void addExams(ArrayList<ComputerizedExam> ExmsLst) {
		if (comExmsLst == null)
			comExmsLst = new ArrayList<ComputerizedExam>();
		comExmsLst.addAll(ExmsLst);
	}

	/**
	 * 
	 * @param Exm
	 *            exam to be added
	 */
	public void addExam(ComputerizedExam Exm) {
		if (comExmsLst == null)
			comExmsLst = new ArrayList<ComputerizedExam>();
		comExmsLst.add(Exm);
	}

	/**
	 * 
	 * @param qstPerExmsLst
	 *            the questions of the exam to be approved
	 */
	public void addQuestionPerExam(ArrayList<QuestionPerExam> qstPerExmsLst) {
		if (qstnPerExmLst == null)
			qstnPerExmLst = new ArrayList<QuestionPerExam>();
		qstnPerExmLst.addAll(qstPerExmsLst);
	}

	/**
	 * 
	 * @param qstPerExm
	 *            a question of the exam to be approved
	 */
	public void addQuestionPerExam(QuestionPerExam qstPerExm) {
		if (qstnPerExmLst == null)
			qstnPerExmLst = new ArrayList<QuestionPerExam>();
		qstnPerExmLst.add(qstPerExm);
	}

	/**
	 * 
	 * @param index
	 *            of the question
	 * @return the selected question
	 */
	public QuestionPerExam getQuestion(int index) {
		return qstnPerExmLst.get(index);
	}

	/**
	 * 
	 * @return the exam's questions
	 */
	public ArrayList<QuestionPerExam> getQuestions() {
		return qstnPerExmLst;
	}

	/**
	 * 
	 * @param index
	 *            of the exam
	 * @return the exam
	 */
	public ComputerizedExam getComputerizedExam(int index) {
		return comExmsLst.get(index);
	}

	/**
	 * @return the comExmsLst
	 */
	public ArrayList<ComputerizedExam> getComputerizedExams() {
		return comExmsLst;
	}

	/**
	 * 
	 * @return the amount of exams
	 */
	public int ComputerizedExamSize() {
		return comExmsLst.size();
	}

	/**
	 * 
	 * @param ansLst
	 *            the answers for an exam
	 * @param index
	 *            of the desired exam
	 */
	public void insertAnswers(ArrayList<Answer> ansLst, int index) {
		comExmsLst.get(index).setAnswers(ansLst);
	}

	/**
	 * @return the exrtExam
	 */
	public ExtractedExam getExrtExam() {
		return exrtExam;
	}

	/**
	 * @param exrtExam
	 *            the exrtExam to set
	 */
	public void setExrtExam(ExtractedExam exrtExam) {
		this.exrtExam = exrtExam;
	}

}
